package com.liunian.algorithmstudy.tree;

public class InvertTree226 extends TreeNode {

	public TreeNode invertTree(TreeNode root) {
		reverseTree(root);
		return root;
	}

	private void reverseTree(TreeNode root) {
		if (root == null) {
			return;
		}
		reverseTree(root.left);
		reverseTree(root.right);
		TreeNode temp = root.left;
		root.left = root.right;
		root.right = temp;
	}

}
